# GSICoreAnalysis task catalogue aggregator

PROJECT_CATALOG_DIR ?= $(MAKEFILE_DIR)
PROJECT_ROOT ?= $(abspath $(PROJECT_CATALOG_DIR)/../..)
GSI_DOC_ROOT ?= $(PROJECT_ROOT)/docs
GSI_REF_PATHS := $(GSI_DOC_ROOT) $(PROJECT_CATALOG_DIR)
GSI_SUCCESS_DIR := logs/gsi/success

define GSI_FIND_REF
$(strip $(firstword $(foreach dir,$(GSI_REF_PATHS),$(if $(wildcard $(dir)/$(1)),$(dir)/$(1)))))
endef

GSI_REF = $(strip $(if $(call GSI_FIND_REF,$(1)),$(call GSI_FIND_REF,$(1)),$(error GSICoreAnalysis reference not found: $(1) (searched $(GSI_REF_PATHS)))))

# Stream task registrations
include $(PROJECT_CATALOG_DIR)includes/streams/sp1.mk
include $(PROJECT_CATALOG_DIR)includes/streams/sp2.mk
include $(PROJECT_CATALOG_DIR)includes/streams/sp3.mk
include $(PROJECT_CATALOG_DIR)includes/streams/sp4.mk
include $(PROJECT_CATALOG_DIR)includes/streams/sp5.mk
include $(PROJECT_CATALOG_DIR)includes/streams/sp6.mk
include $(PROJECT_CATALOG_DIR)includes/streams/sp7.mk
include $(PROJECT_CATALOG_DIR)includes/streams/cross.mk

# Task dependencies
$(call REGISTER_DEP,GSI_SP1_REGRESSION,GSI_SP1_NATIVE)
$(call REGISTER_DEP,GSI_SP1_PERF,GSI_SP1_NATIVE)
$(call REGISTER_DEP,GSI_SP1_HARDEN,GSI_SP1_PERF)
$(call REGISTER_DEP,GSI_SP1_SIGNOFF,GSI_SP1_HARDEN)

$(call REGISTER_DEP,GSI_SP2_VALIDATION,GSI_SP2_CRTM)
$(call REGISTER_DEP,GSI_SP2_MULTI,GSI_SP2_VALIDATION)
$(call REGISTER_DEP,GSI_SP2_VARBC,GSI_SP2_MULTI)

$(call REGISTER_DEP,GSI_SP3_QC,GSI_SP2_CRTM)
$(call REGISTER_DEP,GSI_SP3_INSTR,GSI_SP2_MULTI)
$(call REGISTER_DEP,GSI_SP3_AUTOMATION,GSI_SP2_VALIDATION)
$(call REGISTER_DEP,GSI_SP3_OVERLAY,GSI_SP3_AUTOMATION)

$(call REGISTER_DEP,GSI_SP4_GOALG,GSI_SP4_PHASEC)

$(call REGISTER_DEP,GSI_SP5_BACKEND_AUTO,GSI_SP5_NAM_CONDITION)
$(call REGISTER_DEP,GSI_SP5_NUMSCALE_TRACE,GSI_SP5_BACKEND_AUTO)
$(call REGISTER_DEP,GSI_SP5_AUTOREGRESSION,GSI_SP5_NUMSCALE_TRACE)
$(call REGISTER_DEP,GSI_SP5_DOC_REFRESH,GSI_SP5_BACKEND_AUTO)
$(call REGISTER_DEP,GSI_SP5_CRTM_PARITY,GSI_SP2_CRTM)

$(call REGISTER_DEP,GSI_SP6_R2,GSI_SP2_VALIDATION)
$(call REGISTER_DEP,GSI_SP6_R2,GSI_SP5_CRTM_PARITY)
$(call REGISTER_DEP,GSI_SP6_R3,GSI_SP6_R2)
$(call REGISTER_DEP,GSI_SP6_R4,GSI_SP6_R3)

$(call REGISTER_DEP,GSI_SP7_ESCALATION,GSI_SP7_CADENCE)

$(call REGISTER_DEP,GSI_CROSS_SP2A,GSI_SP2_CRTM)
$(call REGISTER_DEP,GSI_CROSS_SP5A,GSI_SP5_NAM_CONDITION)
$(call REGISTER_DEP,GSI_CROSS_SP4G,GSI_SP4_GOALG)
$(call REGISTER_DEP,GSI_CROSS_SP3DOC,GSI_SP3_OVERLAY)
$(call REGISTER_DEP,GSI_CROSS_SP6PUBLISH,GSI_SP6_R3)
